package com.tronsis.library.db;

import android.content.Context;

import com.litesuits.orm.LiteOrm;

/**
 * 数据库操作入口
 *
 * @author allen@tronsis.com
 */
public class DBUtil {
    public static final String DB_NAME = "com.tronsis.distribution.db";
    private static LiteOrm mLiteOrm;

    public static LiteOrm getInstance(Context context) {
        if (mLiteOrm == null) {
            mLiteOrm = LiteOrm.newCascadeInstance(context, DB_NAME);
        }
        mLiteOrm.setDebugged(true);
        return mLiteOrm;
    }

    public void deleteDB(Context context) {
        if (mLiteOrm == null) {
            mLiteOrm = LiteOrm.newSingleInstance(context, DB_NAME);
        }
        mLiteOrm.deleteDatabase();
    }
}
